//
//  BankListViewController.m
//  YiBaoStore
//
//  Created by 吕清毅 on 2018/11/25.
//  Copyright © 2018年 小河. All rights reserved.
//

#import "BankListViewController.h"

@interface BankListViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic,strong) UITableView *tableView;
@property (nonatomic,strong) NSMutableArray *dataArray;
@end

@implementation BankListViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.bgNavView.hidden = YES;
    [self.view addSubview:self.tableView];
    [self setNaviWith:@"支持银行借记卡"];
}


-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return _dataArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *MyIdentifier = @"UITableViewCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
   // cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    cell.textLabel.textColor = titleColor;
    cell.backgroundColor = indexPath.row%2 == 0 ? UIColorFromHex(0xF1F1F1):TotalWhite;
    cell.textLabel.font = FontMediumWithSize(16);
    cell.textLabel.attributedText = [TTKUtil getAtttributeStringWithLineSpace:0 kern:-1 and:self.dataArray[indexPath.row]];
    return cell;
}

- (UITableView *)tableView
{
    if (_tableView == nil) {
        if (@available(iOS 11.0, *)) {
            self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(0,TopBarHeight_xs, SCREENWIDTH, SCREENHEIGHT-TopBarHeight_xs-BottomHeight_xs) style:UITableViewStylePlain];
        } else {
            // Fallback on earlier versions
            self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(0,TopBarHeight, SCREENWIDTH, SCREENHEIGHT-TopBarHeight-BottomHeight) style:UITableViewStylePlain];
        }
        self.tableView.backgroundColor = TotalWhite;
        self.tableView.delegate = self;
        self.tableView.dataSource = self;
        self.tableView.estimatedRowHeight = 0;
        self.tableView.estimatedSectionHeaderHeight = 0;
        self.tableView.estimatedSectionFooterHeight = 0;
        [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"UITableViewCell"];
        self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        self.tableView.rowHeight = 40;
        if (self.dataArray.count == 0) {
            //self.tableView.tableFooterView = [self setNoDataView];
        }else
        {
            self.tableView.tableFooterView = [[UIView alloc]initWithFrame:CGRectZero];
        }
        [TTKUtil setAutomaticallyAdjustsScrollViewInsetsWidth:self.tableView withView:self];
    }
    return _tableView;
}

- (NSMutableArray *)dataArray
{
    if (_dataArray == nil) {
        _dataArray = [NSMutableArray array];
        NSArray *array = @[@"工商银行",@"农业银行",@"中国银行",@"建设银行",@"邮储银行",@"招商银行",@"平安银行",@"华夏银行",@"光大银行",@"浦发银行",@"中信银行",@"兴业银行"];
        [_dataArray addObjectsFromArray:array];
    }
    return _dataArray;
}

@end
